#include <iostream>
using namespace std;

#if 0
#define DEBUG
#endif

int S;
int N;

int main() {
    cin >> S;

    int SI = 0;
    for(int i = 1; i <= S; ++i) {
        SI += i;;
        int SR = SI - S;
#if defined(DEBUG)
        cout<< "i: " << i << "\tSI: " << SI 
            << "\tSR: " << SR << endl;
#endif
        if (SR % 2 != 0 || SR < 0) continue;
        SR /= 2;
        if (SR  >= 0 && SR <= SI) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}
